<?php
//-------------------------------------------------------------------------------------------------------
    require_once('../config.inc.php');

    require_once($config['app_dir'] . '/classes/StockMailers.class.php');
    //---------------------------------------------------------------------------------------------------
    if( 'cli'==php_sapi_name() ) {
        if ($argc != 4 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
            echo "<tarde> <start> <finish>";
            exit;
        } else {
            $trade=intval($argv[1]);
            $start = strval($argv[2]);
            $finish = strval($argv[3]);
            try {
                $StockMailer = new objStockParamMailer(intval($argv[1]), strval($argv[2]), strval($argv[3]));
                $StockMailer->Send();
            } catch(exception $e) {
                die('Error: '.$e->getMessage());
            }
        }
    } else {
        $StockParams = new objStockParams();
        $trade = $StockParams->trade;
        $start = $StockParams->start;
        $finish = $StockParams->finish;
    	try {
       	   $StockMailer = new objStockParamMailer($StockParams->trade, $StockParams->start, $StockParams->finish);
           $StockMailer->Send();
        } catch(exception $e) {
            die('Error: '.$e->getMessage());
        }
    }
//-------------------------------------------------------------------------------------------------------
?>
